//
//  HBFollowItemCell.m
//  HeartBeat
//
//  Created by karong on 2023/8/28.
//

#import "HBFollowItemCell.h"
@interface HBFollowItemCell ()
@property (weak, nonatomic) IBOutlet UILabel *laseReadLabel;
@property (weak, nonatomic) IBOutlet UIButton *readBtn;
@property (weak, nonatomic) IBOutlet UILabel *authorLabel;
@property (weak, nonatomic) IBOutlet UIButton *selectBtn;
@end

@implementation HBFollowItemCell
- (void)setDataWithObject:(HBNovelModel *)object edit:(BOOL)edit {
    [super setDataWithObject:object];
    self.authorLabel.text = object.author;
    
    NSString * lastRead = (object.chapter_sort > 0)?SF(WSLocalized(@"讀到第%ld話"), object.chapter_sort):WSLocalized(@"未讀");
    NSString * newChapter = SF(WSLocalized(@"更新至第%ld話"), object.newest_chapter.sort);
    self.laseReadLabel.text = SF(@"%@/%@", lastRead, newChapter);
    self.selectBtn.hidden = !edit;
    self.readBtn.hidden = edit;
    self.selectBtn.selected = object.isSelected;
}
@end
